function getHeight(val) { return parseInt(document.getElementById(val).style.height.slice(0, -2)); }
$("#body-cover").height(document.documentElement.clientHeight - 100);
$("#main").css("max-height",(getHeight("body-cover") - 230));
window.onresize = function () {
    $("#body-cover").height(document.documentElement.clientHeight - 100);
    $("#main").css("max-height", (getHeight("body-cover") - 230));
    if (document.getElementById("main").scrollTop + document.getElementById("main").clientHeight + 50 >= document.getElementById("main").scrollHeight) {
        document.getElementById('main').scrollTop=document.getElementById('main').scrollHeight+50;
        $("#goto-bottom").fadeOut(1000);
    } else {
        $("#goto-bottom").fadeIn(1000);
    }
}